// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import i18n from './locales'
import bootstrap from './core/bootstrap'
import { ConfigProvider, Icon, Button, Tag, Menu, Dropdown, Avatar, Spin, Result, Form, Tabs, Input, Checkbox, Select, Radio, TimePicker, Slider, DatePicker, InputNumber, Row, Col, Modal, Alert, Divider, notification, message, Table, Pagination, Breadcrumb, Space, FormModel, Card, Tree, Descriptions, Upload, List, Transfer, TreeSelect, skeleton, Drawer, Popconfirm } from 'ant-design-vue'
import ProLayout, { PageHeaderWrapper } from '@ant-design-vue/pro-layout'
import { PageLoading } from '@/components'
import themeConfig from './config/theme.config.js'
import Dialog from '@/components/Dialog'
import utils from '@/utils/utils.js'

import action from '@/core/directives/action.js'
import actionDauth from '@/core/directives/action-dauth.js'

import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

// 路由守卫
import './router/router-guards'
// 其他
import './styles/global.less'
import ElementUI from 'element-ui'
import AsyncComputed from 'vue-async-computed'

import uploader from 'vue-simple-uploader'
// 加载基础ElementUI

import '../package/theme/element-variables.scss'
import { vuePlugin } from '@/highlight'
import 'highlight.js/styles/atom-one-dark-reasonable.css'
import MyPD from '../package/index.js'
import '../package/theme/index.scss'
import 'bpmn-js/dist/assets/diagram-js.css'
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css'
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'
import 'bpmn-js-properties-panel/dist/assets/bpmn-js-properties-panel.css' // 右边工具栏样式

// 引入拖拽表单
import KFormDesign from './components/k-form-design/packages'
import './components/k-form-design/styles/form-design.less'
import 'ant-design-vue/dist/antd.less'

// 引入自定义组件
import currentUserOrganize from './components/k-form-design/customize/currentUserOrganize'
import selectUserOrganize from './components/k-form-design/customize/selectUserOrganize'
import approvalComments from './components/k-form-design/customize/approvalComments'
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import Cookies from 'js-cookie'
import moment from "moment"
import 'moment/locale/zh-cn'
moment.locale('zh-cn')


Vue.use(AsyncComputed)

Vue.use(VueQuillEditor)
Vue.use(ElementUI)

// Ant Design Vue
Vue.use(ConfigProvider)
Vue.use(Icon)
Vue.use(Tag)
Vue.use(Button)
Vue.use(Menu)
Vue.use(Dropdown)
Vue.use(Avatar)
Vue.use(Spin)
Vue.use(Result)
Vue.use(Form)
Vue.use(Tabs)
Vue.use(Input)
Vue.use(Checkbox)
Vue.use(Select)
Vue.use(Radio)
Vue.use(TimePicker)
Vue.use(Slider)
Vue.use(DatePicker)
Vue.use(InputNumber)
Vue.use(Row)
Vue.use(Col)
Vue.use(Modal)
Vue.use(Alert)
Vue.use(Divider)
Vue.use(Table)
Vue.use(Pagination)
Vue.use(Breadcrumb)
Vue.use(Space)
Vue.use(Dialog)
Vue.use(FormModel)
Vue.use(Card)
Vue.use(Tree)
Vue.use(Descriptions)
Vue.use(Upload)
Vue.use(List)
Vue.use(Transfer)
Vue.use(TreeSelect)
Vue.use(utils)
Vue.use(action)
Vue.use(actionDauth)
Vue.use(skeleton)
Vue.use(Drawer)
Vue.use(Popconfirm)

Vue.prototype.$confirm = Modal.confirm
Vue.prototype.$message = message
Vue.prototype.$notification = notification
Vue.prototype.$info = Modal.info
Vue.prototype.$success = Modal.success
Vue.prototype.$error = Modal.error
Vue.prototype.$warning = Modal.warning

// ProLayout
Vue.component('pro-layout', ProLayout)
Vue.component('page-container', PageHeaderWrapper)
Vue.component('page-header-wrapper', PageHeaderWrapper)
window.umi_plugin_ant_themeVar = themeConfig.theme

// Global imports
Vue.use(PageLoading)

Vue.config.productionTip = false
Vue.use(uploader)
Vue.use(vuePlugin)
Vue.use(MyPD)

Vue.config.productionTip = false
// 使用KFormDesign的setConfig函数添加自定义组件
KFormDesign.setConfig({
  title: '定义字段',
  list: [
    {
      type: 'loginUserOrganize', // 组件类型
      label: '当前用户/组织', // 组件名称
      // icon: 'icon-zidingyiyemian',
      component: currentUserOrganize, // 组件
      options: {
        option_type: '',
        defaultValue: '', // 默认值
        multiple: false, // 多选
        disabled: false, // 禁用
        width: '100%', // 宽度
        min: 0, // 最小值
        max: 99, // 最大值
        clearable: true, // 可清除
        placeholder: '请选择', // 占位内容
        showSearch: false, // 可搜索
      },
      model: '', // 数据字段
      key: '',
      rules: [ // 校验规则
        {
          required: false,
          message: '必填项',
        },
      ],
    },
    {
      type: 'selectUserOrganize', // 组件类型
      label: '选择用户/组织', // 组件名称
      // icon: 'icon-zidingyiyemian',
      component: selectUserOrganize, // 组件
      options: {
        option_type: '',
        defaultValue: '', // 默认值
        multiple: false, // 多选
        disabled: false, // 禁用
        width: '100%', // 宽度
        min: 0, // 最小值
        max: 99, // 最大值
        clearable: true, // 可清除
        placeholder: '请选择', // 占位内容
        showSearch: false, // 可搜索
      },
      model: '', // 数据字段
      key: '',
      rules: [ // 校验规则
        {
          required: false,
          message: '必填项',
        },
      ],
    },
    {
      type: 'approvalComments', // 组件类型
      label: '审批意见', // 组件名称
      // icon: 'icon-zidingyiyemian',
      component: approvalComments, // 组件
      options: {
        option_type: '',
        defaultValue: '', // 默认值
        multiple: false, // 多选
        disabled: false, // 禁用
        width: '100%', // 宽度
        min: 0, // 最小值
        max: 99, // 最大值
        clearable: true, // 可清除
        placeholder: '请选择', // 占位内容
        showSearch: false, // 可搜索
      },
      model: '', // 数据字段
      key: '',
      rules: [ // 校验规则
        {
          required: false,
          message: '必填项',
        },
      ],
    },
  ],
})

Vue.use(KFormDesign)

new Vue({
  router,
  store,
  i18n,
  created: bootstrap,
  render: h => h(App),
}).$mount('#app')
